package com.ihr360.payroll.type;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ihr360.commons.model.annotation.EnumData;
import com.ihr360.commons.serializer.jackson.EnumDataSerializer;

import java.io.Serializable;

/**
 * 员工薪资调整类型
 */
@EnumData
@JsonSerialize(using = EnumDataSerializer.class)
public enum SalaryProfileChangeType implements Serializable {

    POSITION_OR_SALARY_ADJUSTMENT("调岗调薪"),
    PROBATION_REVIEW("转正"),
    ONBOARD("入职"),
    DIMISSION("离职"),
    INIT("初始化");

    private String title;


    @JsonCreator
    public static SalaryProfileChangeType factory(@JsonProperty(value = "id") String id) {
        return SalaryProfileChangeType.valueOf(id);
    }


    SalaryProfileChangeType(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public static SalaryProfileChangeType getChangeType(String title) {
        for (SalaryProfileChangeType changeType : SalaryProfileChangeType.values()) {
            if (changeType.getTitle().equals(title)) {
                return changeType;
            }
        }
        return null;
    }


}
